using System;
using System.Threading;
using System.Numerics;

namespace ReactiveCode
{
    class Time
    {
        #region Current

        static object _lock = new object();
        static Time _current = new Time(BigInteger.Zero);
        internal static Time Current
        {
            get
            {
                lock (_lock)
                {
                    return _current++;
                }
            }
        }

        #endregion

        #region State

        BigInteger _value;

        Time(BigInteger value)
        {
            _value = value;
        }

        #endregion

        #region Operators

        public static Time operator ++ (Time time)
        {
            if (time == null)
                return null;
            return new Time(time._value + 1);
        }

        #endregion

        public int CompareTo(Time time)
        {
            if (time == null)
                return 1;
            return _value.CompareTo(time._value);
        }
    }
}